﻿USE LineWatchSimple
GO
IF NOT EXISTS
(
  SELECT 1
  FROM   sys.objects
  WHERE  object_id = Object_Id(N'[dbo].[LineInfo]')
  AND    type = N'U'
)
BEGIN
  CREATE TABLE [dbo].[LineInfo](
    [LineInfoId]   [bigint] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
	[LineCode]     [nvarchar](200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[MachineType]  [nvarchar](500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  ) ON [PRIMARY]
END
GO
IF NOT EXISTS
(
  SELECT 1
  FROM   sys.objects
  WHERE  object_id = Object_Id(N'[dbo].[LineShift]')
  AND    type = N'U'
)
BEGIN
  CREATE TABLE [dbo].[LineShift](
    [LineShiftId]  [bigint] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
	[LineCode]     [nvarchar](200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Shift]        [nvarchar](200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[StartTime]    [nvarchar](200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[EndTime]      [nvarchar](200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[RestTime]     [bigint] NULL,
	[PlanNum]      [bigint] NULL
  ) ON [PRIMARY]
END
GO
IF NOT EXISTS
(
  SELECT 1
  FROM   sys.objects
  WHERE  object_id = Object_Id(N'[dbo].[ProductInfo]')
  AND    type = N'U'
)
BEGIN
  CREATE TABLE [dbo].[ProductInfo](
    [ProductInfoId]  [bigint] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
	[LineCode]       [nvarchar](200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Shift]          [nvarchar](200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[WorkDate]       [nvarchar](200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[ProductNum]     [bigint] NULL	
  ) ON [PRIMARY]
END
GO
IF NOT EXISTS
(
  SELECT 1
  FROM   sys.objects
  WHERE  object_id = Object_Id(N'[dbo].[CommentInfo]')
  AND    type = N'U'
)
BEGIN
  CREATE TABLE [dbo].[CommentInfo](
    [CommentInfoId]  [bigint] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
	[Comment]        [nvarchar](4000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  ) ON [PRIMARY]
END
GO